/**
 * Created with CLion.
 * Description: 线程安全的堆栈类定义(概述)
 * User: cyber
 * Date: 2020-09-09
 * Time: 12:48
 */
#include <exception>
#include <memory>       // For std::shared_ptr<>

struct empty_stack
    : std::exception
{
    const char *what() const throw();
};

template<typename T>
class threadsafe_stack
{
public:
    threadsafe_stack();
    threadsafe_stack(const threadsafe_stack &);
    threadsafe_stack &operator=(const threadsafe_stack &) = delete; // 1 赋值操作被删除
    void push(T new_value);
    std::shared_ptr<T> pop();
    void pop(T &value);
    bool empty() const;
};